<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link href="__ROOT__/statics/admin/css/style.css" rel="stylesheet" type="text/css"/>
<link href="__ROOT__/statics/css/dialog.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="__ROOT__/statics/js/jquery/jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript" src="__ROOT__/statics/admin/js/admin_common.js"></script>
<script language="javascript" type="text/javascript" src="__ROOT__/statics/js/dialog.js"></script>
<script language="javascript" type="text/javascript" src="__ROOT__/statics/js/jquery/plugins/formvalidator.js" charset="UTF-8"></script>
<script language="javascript" type="text/javascript" src="__ROOT__/statics/js/jquery/plugins/formvalidatorregex.js" charset="UTF-8"></script>
<script language="javascript">
var URL = '__URL__';
var ROOT_PATH = '__ROOT__';
var APP	 =	 '__APP__';
var lang_please_select = "<?php echo (L("please_select")); ?>";
</script>
<title><?php echo (L("website_manage")); ?></title>
</head>

<body>
<?php if(($sub_menu != '') OR ($big_menu != '')): ?><div class="subnav">
    <div class="content-menu ib-a blue line-x">
    	<?php if(!empty($big_menu)): ?><a class="add fb" href="<?php echo ($big_menu["0"]); ?>"><em><?php echo ($big_menu["1"]); ?></em></a>　<?php endif; ?>
        <?php if(!empty($sub_menu)): ?><?php if(is_array($sub_menu)): $key = 0; $__LIST__ = $sub_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): ++$key;$mod = ($key % 2 )?><?php if($key != '1'): ?><span>|</span><?php endif; ?>
        <a href="<?php echo u($val['c'].'/'.$val['a'], array('menuid'=>$val['id']));?>" <?php if($curr_menuid == $val['id']): ?>class="on"<?php endif; ?>><em><?php echo ($val["title"]); ?></em></a><?php endforeach; endif; else: echo "" ;endif; ?><?php endif; ?>
    </div>
</div><?php endif; ?>
<div class="pad-lr-10">
    <form id="myform" name="myform" action="<?php echo u('cate/delete');?>" method="post" onsubmit="return check();">
    <div class="table-list">
    <table width="100%" cellspacing="0">
        <thead>
            <tr>
                <th width="4%"><input type="checkbox" value="" id="check_box" onclick="selectall('cate_id[]');"></th>
              <th><?php echo (L("cate_name")); ?></th>
              <th width="10%"><?php echo (L("sort_order")); ?></th>
                <th width="10%"><?php echo (L("operations_manage")); ?></th>
            </tr>
        </thead>
    	<tbody>
        <?php if(is_array($cate_list['parent'])): $i = 0; $__LIST__ = $cate_list['parent'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): ++$i;$mod = ($i % 2 )?><tr>
            <td align="center"><input type="checkbox" value="<?php echo ($val["cate_id"]); ?>" name="cate_id[]"></td>
            <td><img src="__ROOT__/statics/admin/images/tv-expandable.gif" />&nbsp;&nbsp;<?php echo ($val["cate_name"]); ?></td>
            <td align="center"><input type="text" class="input-text-c input-text" value="<?php echo ($val["sort_order"]); ?>" size="4" name="listorders[<?php echo ($val["cate_id"]); ?>]"></td>
            <td align="center"><a href="javascript:edit(<?php echo ($val["cate_id"]); ?>,'<?php echo ($val["cate_name"]); ?>')"><?php echo (L("edit")); ?></a> | <a href="<?php echo u('cate/delete', array('cate_id'=>$val['cate_id']));?>" onclick="return confirm('<?php echo sprintf(L('confirm_del'),$val['cate_name']);?>')"><?php echo (L("delete")); ?></a></td>
        </tr>
        	<?php if(is_array($cate_list['sub'][$val['cate_id']])): $i = 0; $__LIST__ = $cate_list['sub'][$val['cate_id']];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$sval): ++$i;$mod = ($i % 2 )?><tr>
                <td align="center"><input type="checkbox" value="<?php echo ($sval["cate_id"]); ?>" name="cate_id[]"></td>
                <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="__ROOT__/statics/admin/images/tv-collapsable.gif" />&nbsp;&nbsp;<?php echo ($sval["cate_name"]); ?></td>
                <td align="center"><input type="text" class="input-text-c input-text" value="<?php echo ($sval["sort_order"]); ?>" size="4" name="listorders[<?php echo ($sval["cate_id"]); ?>]"></td>
                <td align="center"><a href="javascript:edit(<?php echo ($sval["cate_id"]); ?>,'<?php echo ($sval["cate_name"]); ?>')"><?php echo (L("edit")); ?></a> | <a href="<?php echo u('cate/delete', array('cate_id'=>$sval['cate_id']));?>" onclick="return confirm('<?php echo sprintf(L('confirm_del'),$sval['cate_name']);?>')"><?php echo (L("delete")); ?></a></td>
            </tr><?php endforeach; endif; else: echo "" ;endif; ?><?php endforeach; endif; else: echo "" ;endif; ?>
    	</tbody>
    </table>

    <div class="btn">
    <label for="check_box"><?php echo (L("select_all")); ?>/<?php echo (L("cancel")); ?></label>
    <input type="submit" class="button" name="dosubmit" value="<?php echo (L("delete")); ?>" onclick="return confirm('<?php echo (L("sure_delete")); ?>')"/>
    <input type="submit" class="button" name="dosubmit" onclick="document.myform.action='<?php echo u("cate/sort_order");?>'" value="<?php echo (L("sort_order")); ?>"/>
    </div>

    </div>
    </form>
</div>
<script type="text/javascript">
function edit(cate_id, name) {
	var lang_edit = "<?php echo (L("edit")); ?>";
	window.top.art.dialog({id:'edit'}).close();
	window.top.art.dialog({title:lang_edit+'--'+name,id:'edit',iframe:'?m=cate&a=edit&cate_id='+cate_id,width:'500',height:'160'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;d.document.getElementById('dosubmit').click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()});
}
var lang_cate_name = "<?php echo (L("cate_name")); ?>";
function check(){
	if($("#myform").attr('action') != '<?php echo u("cate/sort_order");?>') {
		var ids='';
		$("input[name='cate_id[]']:checked").each(function(i, n){
			ids += $(n).val() + ',';
		});

		if(ids=='') {
			window.top.art.dialog({content:lang_please_select+lang_cate_name,lock:true,width:'200',height:'50',time:1.5},function(){});
			return false;}
	}
	return true;
}
</script>
</body>
</html>